package com.xes.attend.server;


import com.xes.attend.config.ServerConfig;
import com.xes.attend.domain.AttendData;
import com.xes.attend.domain.BaseException;
import com.xes.attend.domain.Result;
import com.xes.attend.service.AttendDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/card")
public class CardController extends BaseController {

	@Autowired
	private AttendDataService attendDataService;
	@Autowired
	private ServerConfig config;

	/***
	 * 考勤
	 * 
	 * @author wjl
	 * @title: read
	 * @date 2015年11月30日 下午6:51:55
	 * @param cardNum
	 * @return AttendData
	 */
	@RequestMapping(value = "/query/{cardNum}", method = RequestMethod.GET)
	public Result<AttendData> read(@PathVariable("cardNum") String cardNum) throws BaseException {
		return attendDataService.doAttend(cardNum, config.getVenueId(), config.getBeginClassTime());
	}
}
